

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>6.1. VMD selections &mdash; MDAnalysis v0.7.5-devel documentation</title>
    <link rel="stylesheet" href="../../_static/sphinxdoc.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../',
        VERSION:     '0.7.5-devel',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within MDAnalysis v0.7.5-devel documentation"
          href="../../_static/opensearch.xml"/>
    <link rel="shortcut icon" href="../../_static/mdanalysis-logo.ico"/>
    <link rel="top" title="MDAnalysis v0.7.5-devel documentation" href="../../index.html" />
    <link rel="up" title="6. Selection exporters" href="../selections_modules.html" />
    <link rel="next" title="6.2. PyMOL selections" href="pymol.html" />
    <link rel="prev" title="6. Selection exporters" href="../selections_modules.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="pymol.html" title="6.2. PyMOL selections"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="../selections_modules.html" title="6. Selection exporters"
             accesskey="P">previous</a> |</li>
        <li><a href="../../index.html">MDAnalysis v0.7.5-devel documentation</a> &raquo;</li>
          <li><a href="../selections_modules.html" accesskey="U">6. Selection exporters</a> &raquo;</li> 
      </ul>
    </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../../index.html">
              <img class="logo" src="../../_static/mdanalysis-logo-200x150.png" alt="Logo"/>
            </a></p>
  <h4>Previous topic</h4>
  <p class="topless"><a href="../selections_modules.html"
                        title="previous chapter">6. Selection exporters</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="pymol.html"
                        title="next chapter">6.2. PyMOL selections</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../_sources/documentation_pages/selections/vmd.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <span class="target" id="module-MDAnalysis.selections.vmd"></span><div class="section" id="vmd-selections">
<h1>6.1. VMD selections<a class="headerlink" href="#vmd-selections" title="Permalink to this headline">¶</a></h1>
<p>Write <a class="reference internal" href="../core/AtomGroup.html#MDAnalysis.core.AtomGroup.AtomGroup" title="MDAnalysis.core.AtomGroup.AtomGroup"><tt class="xref py py-class docutils literal"><span class="pre">MDAnalysis.core.AtomGroup.AtomGroup</span></tt></a> selection to a <a class="reference external" href="http://www.ks.uiuc.edu/Research/vmd/">VMD</a> <cite>tcl</cite> file
that defines <a class="reference external" href="http://www.ks.uiuc.edu/Research/vmd/current/ug/node120.html">atomselect macros</a>. To be used in VMD like this:</p>
<div class="highlight-python"><pre>source macros.vmd
set sel [atomselect top mdanalysis001]  # use macro 001</pre>
</div>
<dl class="class">
<dt id="MDAnalysis.selections.vmd.SelectionWriter">
<em class="property">class </em><tt class="descclassname">MDAnalysis.selections.vmd.</tt><tt class="descname">SelectionWriter</tt><big>(</big><em>filename</em>, <em>mode='wa'</em>, <em>numterms=None</em>, <em>preamble=None</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#MDAnalysis.selections.vmd.SelectionWriter" title="Permalink to this definition">¶</a></dt>
<dd><p>Set up for writing to <em>filename</em>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Arguments :</th><td class="field-body"><dl class="first last docutils">
<dt><em>filename</em></dt>
<dd><p class="first last">output file</p>
</dd>
<dt><em>mode</em></dt>
<dd><p class="first last">overwrite (&#8220;w&#8221;) for every write, append (&#8220;a&#8221;) to existing
file, or overwrite an existing file and then append (&#8220;wa&#8221;) [&#8220;wa&#8221;]</p>
</dd>
<dt><em>numterms</em></dt>
<dd><p class="first last">number of individual index numbers per line for output
formats that write multiple entries in one line. If set
to 0 or <tt class="xref docutils literal"><span class="pre">False</span></tt> then no special formatting is done  [8]</p>
</dd>
<dt><em>preamble</em></dt>
<dd><p class="first last">string that is written as a comment at the top of the file []</p>
</dd>
<dt><em>kwargs</em></dt>
<dd><p class="first last">use as defaults for <a class="reference internal" href="#MDAnalysis.selections.vmd.SelectionWriter.write" title="MDAnalysis.selections.vmd.SelectionWriter.write"><tt class="xref py py-meth docutils literal"><span class="pre">write()</span></tt></a></p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="MDAnalysis.selections.vmd.SelectionWriter.comment">
<tt class="descname">comment</tt><big>(</big><em>s</em><big>)</big><a class="headerlink" href="#MDAnalysis.selections.vmd.SelectionWriter.comment" title="Permalink to this definition">¶</a></dt>
<dd><p>Return string <em>s</em> interpolated into the comment format string.</p>
<p>If no <tt class="xref py py-attr docutils literal"><span class="pre">SelectionWriter.commentfmt</span></tt> is defined (None) then the
empty string is returned because presumably there is no way to enter
comments into the file.</p>
<p>A newline is appended to non-empty strings.</p>
</dd></dl>

<dl class="method">
<dt id="MDAnalysis.selections.vmd.SelectionWriter.write">
<tt class="descname">write</tt><big>(</big><em>selection</em>, <em>number=None</em>, <em>name=None</em>, <em>frame=None</em>, <em>mode=None</em><big>)</big><a class="headerlink" href="#MDAnalysis.selections.vmd.SelectionWriter.write" title="Permalink to this definition">¶</a></dt>
<dd><p>Write selection to the output file.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Arguments :</th><td class="field-body"><dl class="first last docutils">
<dt><em>selection</em></dt>
<dd><p class="first last">a <a class="reference internal" href="../core/AtomGroup.html#MDAnalysis.core.AtomGroup.AtomGroup" title="MDAnalysis.core.AtomGroup.AtomGroup"><tt class="xref py py-class docutils literal"><span class="pre">MDAnalysis.core.AtomGroup.AtomGroup</span></tt></a></p>
</dd>
<dt><em>number</em></dt>
<dd><p class="first last">selection will be named &#8220;mdanalysis&lt;number&gt;&#8221;
(<tt class="xref docutils literal"><span class="pre">None</span></tt> auto increments between writes; useful
when appending) [<tt class="xref docutils literal"><span class="pre">None</span></tt>]</p>
</dd>
<dt><em>name</em></dt>
<dd><p class="first last">selection will be named <em>name</em> (instead of numbered)
[<tt class="xref docutils literal"><span class="pre">None</span></tt>]</p>
</dd>
<dt><em>frame</em></dt>
<dd><p class="first last">write selection of this frame (or the current one if
<tt class="xref docutils literal"><span class="pre">None</span></tt> [<tt class="xref docutils literal"><span class="pre">None</span></tt>]</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="MDAnalysis.selections.vmd.SelectionWriter.write_preamble">
<tt class="descname">write_preamble</tt><big>(</big><big>)</big><a class="headerlink" href="#MDAnalysis.selections.vmd.SelectionWriter.write_preamble" title="Permalink to this definition">¶</a></dt>
<dd><p>Write a header, depending on the file format.</p>
</dd></dl>

</dd></dl>

</div>


          </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="pymol.html" title="6.2. PyMOL selections"
             >next</a> |</li>
        <li class="right" >
          <a href="../selections_modules.html" title="6. Selection exporters"
             >previous</a> |</li>
        <li><a href="../../index.html">MDAnalysis v0.7.5-devel documentation</a> &raquo;</li>
          <li><a href="../selections_modules.html" >6. Selection exporters</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2005-2011, Naveen Michaud-Agrawal, Elizabeth J. Denning, Joshua Adelman,
    Christian Beckstein (logo), David Caplan, Jan Domański, Philip Fowler,
    Joseph Goose, Benjamin Hall, Danny Parton, Tyler Reddy, Paul Rigor,
    and Oliver Beckstein.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
    </div>
  </body>
</html>